<template>
	<view>
		<view class="demos-header">
			<span class="header-title">绑定户表</span>
		</view>
		<!-- 绑定客户 -->
		<div class="weui-cells weui-cells_form">
			<!---->
			<div class="weui-cell">
				<div class="weui-cell__hd"><label class="weui-label">户名</label></div>
				<div class="weui-cell__bd"><input type="text" placeholder="请输入户名" class="weui-input" v-model="name"></div>
			</div>
			<div class="weui-cell">
				<div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
				<div class="weui-cell__bd"><input type="text" placeholder="请输入手机号" class="weui-input" v-model="mobile"></div>
			</div>
			<div class="weui-btn-area"><a href="javascript:" class="weui-btn weui-btn_primary" @click="submitBind">提交</a></div>
		</div>
		<div class="weui-tabbar">
			<navigator url="/pages/index/index" class="weui-tabbar__item weui-bar__item--on router-link-active">
				<div class="weui-tabbar__icon"><img src="static/home-logo.png" alt=""></div>
				<p class="weui-tabbar__label">首页</p>
			</navigator>
		</div>
	</view>
</template>


<script>
	import config from '@/common/config.js';
	export default {
		components: {

		},
		data() {
			return {
				name:'',
				mobile:'',
				code:''
			}
		},
		onLoad() {
			this.code=uni.getStorageSync("tokentp")
		},

		onShow() {

		},

		methods: {
			
			submitBind(){
				if(!this.name){
					uni.showModal({
						title:"提示",
						content:"必须输入户名",
						showCancel:false
					})
					return false;
				}
				if(!this.mobile){
					uni.showModal({
						title:"提示",
						content:"必须输入手机号",
						showCancel:false
					})
					return false;
				}
				this.$request.post('wechat/bindCustomer', {
					name: this.name,
					mobile:this.mobile,
					code:this.code,
					appid:config.appid,
					tenantId:config.tenantId
				}).then(res => {
					console.log(res)
					if (res.result > 0) {
						this.$util.tips("绑定成功","/pages/charge/index")
					}
				})
			}
		}
	}
</script>


<style lang="scss" scoped>
	.header {
		background: linear-gradient(90deg, #48da94, #1ccfc0);
		text-align: center;
		height: 16px;
		line-height: 16px;
		padding: 35px 0;
	}

	.header-title {
		font-size: 32px;
		font-weight: 340;
	}
</style>
